import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

export default defineConfig({
  server: {
    open: true, // 项目启动时是否打开页面
    host: "127.0.0.1",
    port: "8888",
    proxy: {
      "^/api/": {
        target: "http://localhost:8888", // 后台服务器地址
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\api/, ""),
      },
    },
  },
  plugins: [vue()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
});
